package com.openness.spider.api;

import java.io.IOException;

import org.apache.zookeeper.KeeperException;

import com.openness.generator.IdGenerator;
import com.openness.generator.IdGeneratorConfig;

/**
 * @author Rain
 * @version 2013-8-4 下午4:28:31
 */

public class IdGeneratorMain {

	public static void main(String[] args) throws IOException, KeeperException,
			InterruptedException {
		IdGeneratorConfig config = new IdGeneratorConfig();

		config.setConnectString("192.168.1.222:2181");

		config.setSessionTimeout(3000);

		IdGenerator generator = new IdGenerator(config, "test");

		Thread thread1 = new GeneratorThread(generator);

		Thread thread2 = new GeneratorThread(generator);

		Thread thread3 = new GeneratorThread(generator);

		thread1.start();

		thread2.start();

		thread3.start();

		thread1.join();

		thread2.join();

		thread3.join();

		generator.close();
	}

}
